package com.gc.server.vo.up;


import com.gc.server.entity.LinkHeadEntity;
import lombok.Data;

import java.util.Date;

import com.alibaba.excel.annotation.*;

import java.io.Serializable;


import com.gc.server.entity.ShopEntity;
import com.gc.server.vo.ShopVo;

import com.gc.server.enums.ShopTypeEnum;

/**
 * 药店实体
 * 表名 shop
 *
 * @author hxf
 * @email 505860922@qq.com
 * @date Thu Oct 22 17:40:23 CST 2020
 */
@Data
public class ShopUp implements Serializable {
    @ExcelIgnore
    private static final long serialVersionUID = 1L;

    //
    @ExcelProperty("")
    private Long id;

    //编号
    @ExcelProperty("编号")
    private String code;

    //连锁编号
    @ExcelProperty("连锁编号")
    private String linkCode;

    //店名
    @ExcelProperty("简称")
    private String shopName;

    //店名
    @ExcelProperty("级别")
    private String level;

    //全名
    @ExcelProperty("全名")
    private String nickName;

    //ENUM-状态:"DIRECT-直营","JOIN-加盟"
    @ExcelIgnore
    private Integer type;
    @ExcelProperty("类型")
    private String typeStr;

    //省
    @ExcelProperty("省")
    private String province;

    //市
    @ExcelProperty("市")
    private String city;

    //县
    @ExcelProperty("县")
    private String county;

    //详细地址
    @ExcelProperty("详细地址")
    private String detail;

    //总部
    @ExcelProperty("总部")
    private String headCode;

    private Long head;

    //备注
    @ExcelProperty("备注")
    private String remark;


    public ShopUp() {

    }

    public ShopVo toVo() {

        ShopEntity entity = new ShopEntity();
        LinkHeadEntity linkHeadEntity = new LinkHeadEntity();
        linkHeadEntity.setCode(headCode);
        ShopVo vo = new ShopVo(entity);
        vo.setHead(linkHeadEntity);
        entity.setId(id);

        entity.setCode(code);

        entity.setLinkCode(linkCode);

        entity.setShopName(shopName);
        entity.setLevel(level);

        entity.setNickName(nickName);

        if (getTypeStr() != null) {
            entity.setType(ShopTypeEnum.nameOf(getTypeStr()));
        }

        entity.setProvince(province);

        entity.setCity(city);

        entity.setCounty(county);

        entity.setDetail(detail);

        entity.setHead(head);

        entity.setRemark(remark);

        return vo;

    }




}
